Support --token-store, --sas-url-secret, --sas-url-secret-name, --yes for container app auth#6660
Conversation
… for az cotnainerapp auth
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| containerapp auth update | cmd containerapp auth update added parameter sas_url_secret_name |
||
| containerapp auth update | cmd containerapp auth update added parameter sas_url_secret |
||
| containerapp auth update | cmd containerapp auth update added parameter token_store |
||
| containerapp auth update | cmd containerapp auth update added parameter yes |
|
Hi @njuCZ, |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
src/containerapp/azext_containerapp/containerapp_auth_decorator.py
Outdated
Show resolved
Hide resolved
src/containerapp/azext_containerapp/containerapp_auth_decorator.py
Outdated
Show resolved
Hide resolved
| if self.get_argument_sas_url_secret() is not None and self.get_argument_sas_url_secret_name() is not None: | ||
| raise ArgumentUsageError('Usage Error: --sas-url-secret and --sas-url-secret-name cannot both be set') | ||
| if self.get_argument_sas_url_secret() is not None and not self.get_argument_yes(): | ||
| msg = 'Configuring --sas-url-secret will add a secret to the containerapp. Are you sure you want to continue?' |
There was a problem hiding this comment.
is it required to add prompt?
There was a problem hiding this comment.
if yes parameter is not passed, there is prompt to let user confirm it.
There was a problem hiding this comment.
It's the same behavior as others. For example: az containerapp microsoft update xxx
| ) | ||
|
|
||
| containerapp_auth_decorator.construct_payload() | ||
| if containerapp_auth_decorator.get_argument_token_store() and containerapp_auth_decorator.get_argument_sas_url_secret() is not None: |
There was a problem hiding this comment.
why not add it in construct_payload()?
There was a problem hiding this comment.
set_secrets func is defined in this file, to avoid dependency loop, so place the logic here
There was a problem hiding this comment.
@Juliehzl
g.custom_command('set', 'set_secrets', exception_handler=ex_handler_factory())
1. set_secrets is a function support command
2. set_secrets will execute ContainerAppClient.create_or_update, I think if it add in construct_payload, maybe will execute twice in some scenario. It should be set in some place which not super() the GA function.
|
|
||
| containerapp_auth_decorator.construct_payload() | ||
| if containerapp_auth_decorator.get_argument_token_store() and containerapp_auth_decorator.get_argument_sas_url_secret() is not None: | ||
| set_secrets(cmd, name, resource_group_name, secrets=[f"{BLOB_STORAGE_TOKEN_STORE_SECRET_SETTING_NAME}={containerapp_auth_decorator.get_argument_sas_url_secret()}"], no_wait=True, disable_max_length=True) |
There was a problem hiding this comment.
combine the method to depcorator to avoid duplicate usage when moving to GA and refine the logic to be same with facbook/microsoft... commands
|
Hi @zhoxing-ms |
Co-authored-by: Xing Zhou <Zhou.Xing@microsoft.com>
… for az cotnainerapp auth
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally?For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.jsonautomatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json.